package cn.iocoder.yudao.module.crossborder.compliance.api;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.crossborder.compliance.api.dto.ComplianceCheckDTO;
import cn.iocoder.yudao.module.crossborder.compliance.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 合规管理 API 接口
 *
 * @author LHL
 */
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
@Tag(name = "RPC 服务 - 合规管理")
public interface ComplianceApi {

    String PREFIX = ApiConstants.PREFIX + "/compliance";

    @GetMapping(PREFIX + "/check/get")
    @Operation(summary = "获得合规检查记录")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    CommonResult<ComplianceCheckDTO> getComplianceCheck(@RequestParam("id") @NotNull Long id);

    @GetMapping(PREFIX + "/check/list")
    @Operation(summary = "获得合规检查记录列表")
    @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
    CommonResult<List<ComplianceCheckDTO>> getComplianceCheckList(@RequestParam("ids") @NotNull List<Long> ids);

    @PostMapping(PREFIX + "/check/create")
    @Operation(summary = "创建合规检查记录")
    CommonResult<Long> createComplianceCheck(@RequestBody @Valid ComplianceCheckDTO complianceCheck);

    @GetMapping(PREFIX + "/check/validate")
    @Operation(summary = "校验商品合规性")
    @Parameter(name = "productId", description = "商品编号", required = true, example = "1024")
    @Parameter(name = "countryCode", description = "国家代码", required = true, example = "US")
    CommonResult<Boolean> validateProductCompliance(@RequestParam("productId") @NotNull Long productId,
                                                   @RequestParam("countryCode") @NotNull String countryCode);

}
